package com.example.lenovo.newgift.http;

import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by Risky57 on 2017/6/27.
 */

public class HttpManager {

    private static final class SingletonHolder{
        private static final HttpManager INSTANCE = new HttpManager();
    }

    public static HttpManager getInstance(){
        return SingletonHolder.INSTANCE;
    }

    private Retrofit mRetrofit;
    private GiftTalkApi mApi;

    private HttpManager(){
        mRetrofit = new Retrofit.Builder()
                .baseUrl(GiftTalkApi.BASE_URL)
                .addConverterFactory(GsonConverterFactory.create())
                .build();
        mApi = mRetrofit.create(GiftTalkApi.class);
    }

    public GiftTalkApi _getApi () {
        return mApi;
    }

    public static GiftTalkApi getApi(){
        return getInstance()._getApi();
    }
}
